import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import sveltePreprocess from 'svelte-preprocess'; // attractions

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [svelte()],
  server: {
    host: "0.0.0.0",
    port: 8082,
    open: false,
    https: false,
    proxy: {
      "/api": "http://localhost:9999/",
      "/ws":{
        //webSocket代理
        target: 'ws://localhost:9999/', // 内网
        /*target: 'ws://服务器地址/ws', // 外网*/
        /*target: 'ws://服务器地址/ws',//本地测试*/
        ws:true,//开启ws, 如果是http代理此处可以不用设置
        changeOrigin: true,
        pathRewrite: {
          '^/ws': '/'
        },
      },
    }
  },
})
